home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / traceimg.ps < prev    next >
Text File  |  1996-01-10  |  2KB  |  44 lines

  1. %    Copyright (C) 1994 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % traceimg.ps
  16. % Trace the data supplied to the 'image' operator.
  17.  
  18. % This code currently handles only the (Level 2) dictionary form of image,
  19. % with a single data source and 8-bit pixels.
  20.  
  21. /traceimage            % <dict> traceimage -
  22.  { currentcolorspace == (setcolorspace\n) print
  23.    (<<) print
  24.    dup { (\t) print exch ==only ( ) print == } forall
  25.    (>>\n) print flush
  26.    begin /i_left Width Height mul store /i_dict currentdict store end
  27.     { i_left 0 le { exit } if
  28.       i_dict /DataSource get exec
  29.       dup type /filetype eq
  30.        { i_buf 0 i_left 32 min getinterval readstring pop
  31.        } if
  32.       dup (%stdout) (w) file exch writehexstring (\n) print flush
  33.       i_left exch length sub /i_left exch def
  34.     } loop
  35.  } bind odef
  36.  
  37. /image /traceimage load def
  38. /i_left 0 def
  39. /i_dict null def
  40. /i_buf 32 string def
  41.